package cn.tedu.oop;

public class TestConstructor2 {
    public static void main(String[] args) {
        //6.1使用无参构造创建对象s1
        //6.1使用含餐构造创建对象s2
        //6.1使用全参构造创建对象s3
        Student s1=new Student();
        Student s2=new Student("哈哈哈");
        Student s3=new Student("张三",'男',"抬杠",100);
        System.out.println(s1.name);
        System.out.println(s2.name);
        System.out.println(s3.name);
    }
}
//1.创建学生类Student
//2.提供学生类的属性：姓名name 性别gender 专业major 分数score
class Student {
    String name;
    char gender;
    String major;
    double score;
    //3.创建本类的无参构造
    public Student(){
        System.out.println("我是本类的无参构造");
    }
    //4.创建本类的含参构造（String s）
    public Student(String s){
        System.out.println("我是本类的含参构造");
    }
    //5.创建本类的全参构造
    public Student(String name, char gender, String major, double score) {
        this.name = name;
        this.gender = gender;
        this.major = major;
        this.score = score;
        System.out.println("我是本类的全参构造");
    }
}
